//
//  HomeNavigateItem.m
//  HomePage
//
//  Created by winston on 13-4-10.
//  Copyright (c) 2013年 winston. All rights reserved.
//

#import "HomeNavigateItem.h"

@implementation HomeNavigateItem
@synthesize moduleKey;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self setBackgroundColor:[UIColor grayColor]];
        
        titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 3, frame.size.width, 25)];
        titleLabel.backgroundColor = [UIColor clearColor];
        titleLabel.textAlignment = NSTextAlignmentLeft;
        titleLabel.font = [UIFont fontWithName:@"Arial" size:20];
        [self addSubview:titleLabel];
        [titleLabel release];
        
        markLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 30, frame.size.width, 20)];
        markLabel.backgroundColor = [UIColor clearColor];
        markLabel.textAlignment = NSTextAlignmentLeft;
        markLabel.font = [UIFont fontWithName:@"Arial" size:12];
        [self addSubview:markLabel];
        [markLabel release];
    }
    return self;
}


-(void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
    if(selected)
    {
        [titleLabel setTextColor:[UIColor redColor]];
        [markLabel setTextColor:[UIColor redColor]];
    }
    else
    {
        [titleLabel setTextColor:[UIColor blackColor]];
        [markLabel setTextColor:[UIColor blackColor]];
    }
}


-(void)loadData:(NSDictionary*)data
{
    [titleLabel setText:[data objectForKey:@"Title"]];
    [markLabel setText:[data objectForKey:@"Mark"]];
}

@end
